Authentication Methods
UTMStack API supports two authentication methods:- Bearer Token Authentication: Uses username/password to obtain a JWT Bearer token for API requests
- API Key Authentication: Uses managed API keys created through UTMStack Settings
Method 1: Bearer Token Authentication
Step 1: Authentication Request
🔧 Request Example:
Make sure to replace the credentials (username and password) with the actual user credentials for your environment.
Step 2: Parse the Response
The response will be a JSON object containing the Bearer token, usually under the key id_token or similar, for example:
Step 3: Use the Bearer Token
Include the token in the Authorization header when making requests to protected endpoints.
Request Example:
Response:
Request without Authorization:
Response:
Method 2: API Key Authentication
API Keys provide a secure alternative to Bearer tokens for programmatic access. They are ideal for integrations, automation scripts, and third-party applications.
Step 1: Create an API Key
Before you can use API Key authentication, you need to create an API key in UTMStack:Create New API Key
Click Create API Key and configure:
- Name: Descriptive name for your integration
- Expires At: Set expiration date
- Allowed IPs: Add IP addresses or CIDR ranges (recommended for security)
Complete API Key Management Guide
For detailed instructions on creating, managing, and securing API keys, see the API Keys Management documentation.
Step 2: Use the API Key in Requests
Include your API key as a Bearer token in theAuthorization header:
The API key is used exactly like a Bearer token - just replace the JWT token with your API key in the Authorization header.
Step 3: API Key Response
When using a valid API key, you’ll receive the same successful response as with JWT authentication:API Key Best Practices
Store Keys Securely
Store Keys Securely
- Never hardcode API keys in source code
- Use environment variables or secret management systems
- Avoid committing keys to version control
- Store in encrypted configuration or password managers
Restrict by IP Address
Restrict by IP Address
Always configure allowed IP addresses when creating API keys:
- Limits access to specific servers or networks
- Prevents unauthorized use if key is compromised
- Use CIDR notation for IP ranges
Set Appropriate Expiration
Set Appropriate Expiration
- Use shorter expiration periods for development (30-90 days)
- Set longer periods for production (6-12 months)
- Rotate keys before expiration
- Remove or regenerate unused keys
Monitor and Audit
Monitor and Audit
- Regularly review active API keys in Settings
- Check last used timestamps
- Monitor for unexpected access patterns
- Set up alerts for failed authentication attempts
One Key Per Integration
One Key Per Integration
Create separate API keys for different:
- Applications or services
- Environments (dev, staging, production)
- Teams or departments
Authentication Methods Comparison
| Feature | Bearer Token (JWT) | API Key |
|---|---|---|
| Use Case | User-based authentication, interactive applications | Server-to-server, automation, integrations |
| Creation | Obtained via login credentials | Created in Settings > API Keys |
| Lifetime | Short-lived, expires after session | Long-lived, custom expiration date |
| Security | User-specific, session-based | Key-specific, can be restricted by IP |
| Revocation | Automatic on logout | Manual deletion or expiration |
| Best For | Web applications, user sessions | Automated scripts, CI/CD, third-party apps |
| Management | Automatic | Manual via Settings UI |
Official API Documentation
UTMStack provides two official resources where developers can explore and interact with the API:Interactive Swagger UI (Demo Instance)
For hands-on testing and live API interaction, you can explore the Swagger UI provided by the public UTMStack demo instance: https://demo.utmstack.com/swagger-ui/index.htmlEach client instance has its own unique Swagger URL, based on how their environment is configured.
https://<your-company>.utmstack.com/swagger-ui/index.htmlhttps://utmstack.<your-domain>.com/swagger-ui/index.html